package com.unionbigdata.examination.controller;

import com.unionbigdata.examination.entity.Student;
import com.unionbigdata.examination.service.StudentService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/student")
@Tag(name = "student", description = "提供学生管理相关的 REST 接口")
public class StudentController {

    private StudentService studentService;

    @Autowired
    public void setStudentService(StudentService studentService) {
        this.studentService = studentService;
    }

    @Operation(summary = "查询单个学生")
    @GetMapping("/{id}")
    public Student find(@PathVariable(value = "id") Long id) {
        return studentService.find(id);
    }
}
